package com.hinnotek.amoeba.adapters.old

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.bean.old.AmibaCustomerProject

/**
 * "通知"列表适配器
 * @author 张洋
 * @since 2020-10-7
 */
class StatisticalCustomerProjectAdapter(data: MutableList<AmibaCustomerProject>?) :
    BaseMultiItemQuickAdapter<AmibaCustomerProject, BaseViewHolder>(data) {

    override fun convert(holder: BaseViewHolder, item: AmibaCustomerProject) {
        when (item.itemType) {
            0 -> holder.setText(R.id.tv_customer_name, item.customerName)
            1 -> {
                holder.setText(R.id.tv_project_name, item.projectName)
                holder.setText(R.id.tv_labor_cost, item.totalPerson)
                holder.setText(R.id.tv_reimbursement_cost, item.totalReimburse)
                holder.setText(R.id.tv_payment_cost, item.totalPay)
                holder.setText(R.id.tv_purchase_cost, item.totalPurchase)
                holder.setText(R.id.tv_install_cost, item.totalInstall)
                holder.setText(R.id.tv_dev_cost, item.totalDevelop)
                holder.setText(R.id.tv_other_cost, item.totalOther)
                holder.setText(R.id.tv_total_cost, item.allMoney)
                holder.setText(R.id.tv_assign_cost, item.totalContract)
                holder.setText(R.id.tv_pay_back_cost, item.totalBack)
            }
        }
    }

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    init {
        addItemType(0, R.layout.item_statistical_customer_project_name)
        addItemType(1, R.layout.item_statistical_customer_project)
    }
}